﻿//<TunynetCopyright>
//--------------------------------------------------------------
//<copyright>青岛拓宇网络科技有限公司 2005-2008</copyright>
//<version>V0.5</verion>
//<createdate>2008-2-23</createdate>
//<author>mazq</author>
//<email>mazq@tunynet.com</email>
//<log date="2008-2-23">创建</log>
//--------------------------------------------------------------
//</TunynetCopyright>


using System;
using System.Collections.Generic;
using System.Text;

namespace ChinaCustoms.Qingdao.Workflow.Supports
{
    /// <summary>
    /// 工作项查询类
    /// </summary>
    public class WorkItemQuery
    {
        /// <summary>
        /// 工作项所对应应用的名称
        /// </summary>
        public string ApplicationCodeName = string.Empty;
        
        /// <summary>
        /// 任务ID
        /// </summary>
        public Guid TaskGuid = Guid.Empty;
        
        /// <summary>
        /// 任务名称
        /// </summary>
        public string TaskName = string.Empty;

        /// <summary>
        /// 任务类型
        /// </summary>
        public string TaskType = string.Empty;

        /// <summary>
        /// 子任务ID
        /// </summary>
        public Guid SubTaskGuid = Guid.Empty;

        /// <summary>
        /// 工作项创建人登陆名称
        /// </summary>
        public string CreatorUserName = string.Empty;

        /// <summary>
        /// 工作项执行人登陆名称
        /// </summary>
        public string ExecutorUserName = string.Empty;

        /// <summary>
        /// 活动编码
        /// </summary>
        public Guid ActivityGuid = Guid.Empty;

        /// <summary>
        /// 工作项类型
        /// </summary>
        public WorkItemType? WorkItemType = null;

        /// <summary>
        /// 工作项状态
        /// </summary>
        public WorkItemStatus? WorkItemStatus = null;

        /// <summary>
        /// 对应的任务状态
        /// </summary>
        public TaskStatus? TaskStatus = null;

        /// <summary>
        /// 排序字段
        /// </summary>
        public SortWorkItemBy SortBy = SortWorkItemBy.CreateDate;

        /// <summary>
        /// 排序方向
        /// </summary>
        public SortOrder SortOrder =  SortOrder.Descending;


        public int PageIndex = 0;
        public int PageSize = 20;
        /// <summary>
        /// 是否要对信息进行分页显示
        /// </summary>
        public bool AllowPaging = false;

        //public string CacheKey
        //{
        //    get
        //    {
        //        return string.Format("WorkItems::TaskStatus:{0}-DateScope:{1}-TaskName:{2}-PI:{3}-PS:{4}-IP:{5}",
        //            TaskStatus.HasValue ? ((int)TaskStatus).ToString() : string.Empty, (int)DateScope, PageIndex, PageSize, IgnorePaging);
        //    }
        //}


    }

    /// <summary>
    /// 按照字段排序的字段名称
    /// </summary>
    public enum SortWorkItemBy
    {
        ActivityGuid=1,
        ActivityName=2,
        TaskGuid=3,
        //----------------------
        TaskName = 4,
        TaskType = 5,
        //----------------------
        SubTaskGuid=6,
        CreatorUserName=7,
        ExecutorUserName=8,
        WorkItemType=9,
        CreateDate=10,
        LastUpdateDate=11,
    }
}
